package com.config;

import org.apache.catalina.Context;
import org.apache.catalina.Globals;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.core.StandardContext;
import org.apache.catalina.startup.Tomcat;

import java.io.File;
import java.net.MalformedURLException;

public class App {
    public static void main(String[] args) throws LifecycleException, MalformedURLException {
        String webAppDirLocation = "src/main/";
        Tomcat tomcat = new Tomcat();

        //Set Port #
        tomcat.setPort(8080);

        tomcat.getConnector();

//        # E:\ideaProject\spring_mvc\src\main
        System.out.println(new File(webAppDirLocation).getAbsolutePath());

        StandardContext ctx = (StandardContext) tomcat.addWebapp("/", new File(webAppDirLocation).getAbsolutePath());

        tomcat.start();
        tomcat.getServer().await();

    }
}